package com.zhuanzhuan.hero.user.recent.assembler;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.zhuanzhuan.hero.biz.common.enums.BizCountType;
import com.zhuanzhuan.hero.user.enums.RecentDataEnum;
import com.zhuanzhuan.hero.user.helper.HeroCounterHelper;
import com.zhuanzhuan.hero.user.recent.assembler.base.RecentMsgAssembleContext;
import com.zhuanzhuan.hero.user.recent.assembler.base.UserRecentMsgAssembler;
import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;

/**
 * @author jiazebiao
 * @date 2024/7/11
 * @description 发布同行圈数
 */
@Component
public class PostMsgAssembler implements UserRecentMsgAssembler {
    private static final List<Integer> RECENT_DAYS = Lists.newArrayList(3,5,7);
    private static final String RECENT_RECYCLE_MSG = "近%s天发布%s条同行圈";

    private static final int SHOW_COUNT_LIMIT = 3;
    @Resource
    private HeroCounterHelper helper;

    @Override
    public Map<Long, EnumMap<RecentDataEnum, String>> assemble(RecentMsgAssembleContext context) {
        Map<Long, EnumMap<RecentDataEnum, String>> rst = helper.assembleRecentMsgByBizCount(BizCountType.USER_POST_COUNT, RecentDataEnum.POST_COUNT, context.getUids(), SHOW_COUNT_LIMIT, RECENT_DAYS, RECENT_RECYCLE_MSG);
        return rst;
    }
}